package com.mumulx.check.web.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/*
 *  Created by IntelliJ IDEA.
 *  User: 木木
 *  Date: 2020/10/22
 *  Time: 21:33
 *  用于配置tomcat虚拟路径
 *  即当请求为/img/**的时候去uploadedFilePathPrefix这个路径下寻找
    用于查看prt的预览图的请求路径·，映射到本地计算机的物理存储位置
 */


@Configuration
public class FileConfig implements WebMvcConfigurer {
    private static final String FILE_PROTOCOL = "file:";

    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        registry.addResourceHandler("/img/**")
                .addResourceLocations(FILE_PROTOCOL+Global.getProfileImg()+"\\");

    }
}